package org.alexisjago.footballmanager.DAO;

import org.alexisjago.footballmanager.domain.Team;

public class TeamDAO implements ITeamDAO {
	
    /* (non-Javadoc)
	 * @see org.alexisjago.footballmanager.DAO.ITeamDAO#getTeam(int)
	 */
    @Override
	public Team getTeam(int teamId){
		Team team = PersistenceManager.entityManager.find(Team.class, teamId);
		return team;
    }
    
	/* (non-Javadoc)
	 * @see org.alexisjago.footballmanager.DAO.ITeamDAO#saveTeam(org.alexisjago.footballmanager.domain.Team)
	 */
	@Override
	public void saveTeam(Team team) {
		PersistenceManager.entityManager.persist(team);
	}
	
	/* (non-Javadoc)
	 * @see org.alexisjago.footballmanager.DAO.ITeamDAO#updateTeam(org.alexisjago.footballmanager.domain.Team)
	 */
	@Override
	public void updateTeam(Team team) {
		PersistenceManager.entityManager.merge(team);
	}
}
